//
//  DXMLTimeStamp.h
//  DerbyStatter
//
//  Created by glenn andreas on 1/29/14.
//  Copyright (c) 2014 glenn andreas. All rights reserved.
//

#import <Foundation/Foundation.h>

@class DXMLObject;
@class DXMLPeriodObject;
@class DXMLJamObject;
// class cluster
@interface DXMLTimestamp : NSObject
@property (readonly) NSString *timestampValue;
@property (readonly) BOOL isEstimate;

@property (readonly) NSDate *date; // could be an estimate or guess
- (NSTimeInterval) periodTime: (DXMLPeriodObject *) period; // this counts up...
- (NSTimeInterval) jamTime: (DXMLJamObject *) jam;
- (id) initWithString: (NSString *) value forObject: (DXMLObject *) object;
@end

@interface DXMLAbsoluteTimestamp : DXMLTimestamp
@property (strong) NSDate *date;
@property (strong) NSTimeZone *timeZone;
@property (strong) NSCalendar *calendar;
@end

@interface DXMLPeriodRelativeTimestamp : DXMLTimestamp
@property (assign) NSTimeInterval relativeTime; // negative value is from the end of the period, but independent of the direction of the period clock
@property (strong) DXMLPeriodObject *period;
@end

@interface DXMLPeriodClockTimestamp : DXMLTimestamp
@property (assign) NSTimeInterval periodClock; // mm * 60 + seconds
@property (strong) DXMLPeriodObject *period;
@end

@interface DXMLJamRelativeTimestamp : DXMLTimestamp
@property (assign) NSTimeInterval relativeTime; // negative value is from the end of the period
@property (strong) DXMLJamObject *jam;
@end


@interface DXMLEstimateTimestamp : DXMLTimestamp
@property (strong) DXMLTimestamp *bestGuess;
@end

@interface DXMLRangeTimestamp : DXMLEstimateTimestamp // if bestGuess hasn't been set, we use half way between earliest and latest
@property (strong) DXMLTimestamp *earliestTime;
@property (strong) DXMLTimestamp *latestTime;
@end